import 'package:FiduMart/generated/json/base/json_convert_content.dart';
import 'package:FiduMart/core/network/model/game_welfare_entity.dart';

GameWelfareEntity $GameWelfareEntityFromJson(Map<String, dynamic> json) {
  final GameWelfareEntity gameWelfareEntity = GameWelfareEntity();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    gameWelfareEntity.id = id;
  }
  final String? nameZh = jsonConvert.convert<String>(json['Name_zh']);
  if (nameZh != null) {
    gameWelfareEntity.nameZh = nameZh;
  }
  final String? nameEn = jsonConvert.convert<String>(json['Name_en']);
  if (nameEn != null) {
    gameWelfareEntity.nameEn = nameEn;
  }
  final String? nameValue = jsonConvert.convert<String>(json['Name_value']);
  if (nameValue != null) {
    gameWelfareEntity.nameValue = nameValue;
  }
  final String? txtZh = jsonConvert.convert<String>(json['txt_zh']);
  if (txtZh != null) {
    gameWelfareEntity.txtZh = txtZh;
  }
  final String? txtEn = jsonConvert.convert<String>(json['txt_en']);
  if (txtEn != null) {
    gameWelfareEntity.txtEn = txtEn;
  }
  return gameWelfareEntity;
}

Map<String, dynamic> $GameWelfareEntityToJson(GameWelfareEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['Name_zh'] = entity.nameZh;
  data['Name_en'] = entity.nameEn;
  data['Name_value'] = entity.nameValue;
  data['txt_zh'] = entity.txtZh;
  data['txt_en'] = entity.txtEn;
  return data;
}

extension GameWelfareEntityExt on GameWelfareEntity {
  GameWelfareEntity copyWith({
    int? id,
    String? nameZh,
    String? nameEn,
    String? nameValue,
    String? txtZh,
    String? txtEn,
  }) {
    return GameWelfareEntity()
      ..id = id ?? this.id
      ..nameZh = nameZh ?? this.nameZh
      ..nameEn = nameEn ?? this.nameEn
      ..nameValue = nameValue ?? this.nameValue
      ..txtZh = txtZh ?? this.txtZh
      ..txtEn = txtEn ?? this.txtEn;
  }
}